<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>数据源配置 - 智能制造分析系统</title>

  <!-- Google Font: Source Sans Pro -->
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
  <!-- Theme style -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/admin-lte@3.2.0/dist/css/adminlte.min.css">
  <!-- Select2 -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@ttskch/select2-bootstrap4-theme@x.x.x/dist/select2-bootstrap4.min.css">
  <!-- DataTables -->
  <link rel="stylesheet" href="https://cdn.datatables.net/1.11.5/css/dataTables.bootstrap4.min.css">
</head>
<body class="hold-transition sidebar-mini">
<div class="wrapper">
  <!-- Navbar -->
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
    </ul>

    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
      <li class="nav-item">
        <a class="nav-link" data-widget="fullscreen" href="#" role="button">
          <i class="fas fa-expand-arrows-alt"></i>
        </a>
      </li>
    </ul>
  </nav>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
  <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <a href="../index.html" class="brand-link">
      <img src="https://adminlte.io/themes/v3/dist/img/AdminLTELogo.png" alt="AdminLTE Logo" class="brand-image img-circle elevation-3" style="opacity: .8">
      <span class="brand-text font-weight-light">智能制造分析</span>
    </a>

    <!-- Sidebar -->
    <div class="sidebar">
      <!-- Sidebar Menu -->
      <nav class="mt-2">
        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
          <li class="nav-item">
            <a href="dashboard.html" class="nav-link">
              <i class="nav-icon fas fa-tachometer-alt"></i>
              <p>生产监控</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="yield-analysis.html" class="nav-link">
              <i class="nav-icon fas fa-chart-pie"></i>
              <p>良率分析</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="equipment-maintenance.html" class="nav-link">
              <i class="nav-icon fas fa-tools"></i>
              <p>设备维护</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="data-source.html" class="nav-link active">
              <i class="nav-icon fas fa-database"></i>
              <p>数据源配置</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="system-settings.html" class="nav-link">
              <i class="nav-icon fas fa-cog"></i>
              <p>系统设置</p>
            </a>
          </li>
          <li class="nav-header">AI功能</li>
          <li class="nav-item">
            <a href="ai/model-management.html" class="nav-link">
              <i class="nav-icon fas fa-brain"></i>
              <p>模型管理</p>
            </a>
          </li>
          <li class="nav-item">
            <a href="ai/prediction-analysis.html" class="nav-link">
              <i class="nav-icon fas fa-chart-line"></i>
              <p>预测分析</p>
            </a>
          </li>
        </ul>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>数据源配置</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">首页</a></li>
              <li class="breadcrumb-item active">数据源配置</li>
            </ol>
          </div>
        </div>
      </div>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <!-- 数据源概览 -->
        <div class="row">
          <div class="col-lg-3 col-6">
            <div class="small-box bg-info">
              <div class="inner">
                <h3>12</h3>
                <p>数据源总数</p>
              </div>
              <div class="icon">
                <i class="fas fa-database"></i>
              </div>
              <a href="#" class="small-box-footer">
                更多信息 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-success">
              <div class="inner">
                <h3>10</h3>
                <p>正常连接</p>
              </div>
              <div class="icon">
                <i class="fas fa-check-circle"></i>
              </div>
              <a href="#" class="small-box-footer">
                更多信息 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-warning">
              <div class="inner">
                <h3>1</h3>
                <p>连接异常</p>
              </div>
              <div class="icon">
                <i class="fas fa-exclamation-triangle"></i>
              </div>
              <a href="#" class="small-box-footer">
                查看详情 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
          <div class="col-lg-3 col-6">
            <div class="small-box bg-danger">
              <div class="inner">
                <h3>1</h3>
                <p>未连接</p>
              </div>
              <div class="icon">
                <i class="fas fa-times-circle"></i>
              </div>
              <a href="#" class="small-box-footer">
                查看详情 <i class="fas fa-arrow-circle-right"></i>
              </a>
            </div>
          </div>
        </div>

        <!-- 数据源列表 -->
        <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">数据源列表</h3>
                <div class="card-tools">
                  <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addDataSourceModal">
                    <i class="fas fa-plus"></i> 添加数据源
                  </button>
                </div>
              </div>
              <div class="card-body">
                <table id="dataSourceTable" class="table table-bordered table-striped">
                  <thead>
                    <tr>
                      <th>数据源名称</th>
                      <th>类型</th>
                      <th>连接地址</th>
                      <th>连接状态</th>
                      <th>最后同步时间</th>
                      <th>操作</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>MES系统</td>
                      <td>MySQL</td>
                      <td>192.168.1.100:3306</td>
                      <td><span class="badge badge-success">正常</span></td>
                      <td>2024-03-15 15:30:00</td>
                      <td>
                        <button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#editDataSourceModal">
                          <i class="fas fa-edit"></i> 编辑
                        </button>
                        <button type="button" class="btn btn-danger btn-sm">
                          <i class="fas fa-trash"></i> 删除
                        </button>
                      </td>
                    </tr>
                    <tr>
                      <td>设备数据</td>
                      <td>MongoDB</td>
                      <td>192.168.1.101:27017</td>
                      <td><span class="badge badge-success">正常</span></td>
                      <td>2024-03-15 15:30:00</td>
                      <td>
                        <button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#editDataSourceModal">
                          <i class="fas fa-edit"></i> 编辑
                        </button>
                        <button type="button" class="btn btn-danger btn-sm">
                          <i class="fas fa-trash"></i> 删除
                        </button>
                      </td>
                    </tr>
                    <tr>
                      <td>质量数据</td>
                      <td>PostgreSQL</td>
                      <td>192.168.1.102:5432</td>
                      <td><span class="badge badge-warning">异常</span></td>
                      <td>2024-03-15 14:30:00</td>
                      <td>
                        <button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#editDataSourceModal">
                          <i class="fas fa-edit"></i> 编辑
                        </button>
                        <button type="button" class="btn btn-danger btn-sm">
                          <i class="fas fa-trash"></i> 删除
                        </button>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>

        <!-- 数据同步状态 -->
        <div class="row">
          <div class="col-12">
            <div class="card">
              <div class="card-header">
                <h3 class="card-title">数据同步状态</h3>
                <div class="card-tools">
                  <button type="button" class="btn btn-tool" data-card-widget="collapse">
                    <i class="fas fa-minus"></i>
                  </button>
                </div>
              </div>
              <div class="card-body">
                <div class="table-responsive">
                  <table class="table table-bordered">
                    <thead>
                      <tr>
                        <th>数据源</th>
                        <th>同步周期</th>
                        <th>上次同步时间</th>
                        <th>下次同步时间</th>
                        <th>同步状态</th>
                        <th>操作</th>
                      </tr>
                    </thead>
                    <tbody>
                      <tr>
                        <td>MES系统</td>
                        <td>5分钟</td>
                        <td>2024-03-15 15:30:00</td>
                        <td>2024-03-15 15:35:00</td>
                        <td><span class="badge badge-success">正常</span></td>
                        <td>
                          <button type="button" class="btn btn-primary btn-sm">
                            <i class="fas fa-sync"></i> 立即同步
                          </button>
                        </td>
                      </tr>
                      <tr>
                        <td>设备数据</td>
                        <td>1分钟</td>
                        <td>2024-03-15 15:30:00</td>
                        <td>2024-03-15 15:31:00</td>
                        <td><span class="badge badge-success">正常</span></td>
                        <td>
                          <button type="button" class="btn btn-primary btn-sm">
                            <i class="fas fa-sync"></i> 立即同步
                          </button>
                        </td>
                      </tr>
                      <tr>
                        <td>质量数据</td>
                        <td>10分钟</td>
                        <td>2024-03-15 15:20:00</td>
                        <td>2024-03-15 15:30:00</td>
                        <td><span class="badge badge-warning">异常</span></td>
                        <td>
                          <button type="button" class="btn btn-primary btn-sm">
                            <i class="fas fa-sync"></i> 立即同步
                          </button>
                        </td>
                      </tr>
                    </tbody>
                  </table>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>

  <!-- 添加数据源模态框 -->
  <div class="modal fade" id="addDataSourceModal">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <h4 class="modal-title">添加数据源</h4>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
          <form>
            <div class="form-group">
              <label>数据源名称</label>
              <input type="text" class="form-control" placeholder="请输入数据源名称">
            </div>
            <div class="form-group">
              <label>数据源类型</label>
              <select class="form-control select2" style="width: 100%;">
                <option selected="selected">MySQL</option>
                <option>PostgreSQL</option>
                <option>MongoDB</option>
                <option>Oracle</option>
                <option>SQL Server</option>
              </select>
            </div>
            <div class="form-group">
              <label>连接地址</label>
              <input type="text" class="form-control" placeholder="请输入连接地址">
            </div>
            <div class="form-group">
              <label>用户名</label>
              <input type="text" class="form-control" placeholder="请输入用户名">
            </div>
            <div class="form-group">
              <label>密码</label>
              <input type="password" class="form-control" placeholder="请输入密码">
            </div>
          </form>
        </div>
        <div class="modal-footer justify-content-between">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <button type="button" class="btn btn-primary">保存</button>
        </div>
      </div>
    </div>
  </div>

  <!-- 编辑数据源模态框 -->
  <div class="modal fade" id="editDataSourceModal">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <h4 class="modal-title">编辑数据源</h4>
          <button type="button" class="close" data-dismiss="modal" aria-label="Close">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">
          <form>
            <div class="form-group">
              <label>数据源名称</label>
              <input type="text" class="form-control" value="MES系统">
            </div>
            <div class="form-group">
              <label>数据源类型</label>
              <select class="form-control select2" style="width: 100%;">
                <option selected="selected">MySQL</option>
                <option>PostgreSQL</option>
                <option>MongoDB</option>
                <option>Oracle</option>
                <option>SQL Server</option>
              </select>
            </div>
            <div class="form-group">
              <label>连接地址</label>
              <input type="text" class="form-control" value="192.168.1.100:3306">
            </div>
            <div class="form-group">
              <label>用户名</label>
              <input type="text" class="form-control" value="admin">
            </div>
            <div class="form-group">
              <label>密码</label>
              <input type="password" class="form-control" placeholder="请输入新密码">
            </div>
          </form>
        </div>
        <div class="modal-footer justify-content-between">
          <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
          <button type="button" class="btn btn-primary">保存</button>
        </div>
      </div>
    </div>
  </div>

  <!-- Main Footer -->
  <footer class="main-footer">
    <div class="float-right d-none d-sm-block">
      <b>Version</b> 1.0.0
    </div>
    <strong>Copyright &copy; 2024 <a href="#">智能制造分析系统</a>.</strong> All rights reserved.
  </footer>
</div>

<!-- jQuery -->
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- Bootstrap 4 -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"></script>
<!-- AdminLTE App -->
<script src="https://cdn.jsdelivr.net/npm/admin-lte@3.2.0/dist/js/adminlte.min.js"></script>
<!-- Select2 -->
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
<!-- DataTables -->
<script src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.11.5/js/dataTables.bootstrap4.min.js"></script>

<script>
  $(function () {
    // 初始化Select2
    $('.select2').select2({
      theme: 'bootstrap4'
    });

    // 初始化DataTable
    $('#dataSourceTable').DataTable({
      "paging": true,
      "lengthChange": true,
      "searching": true,
      "ordering": true,
      "info": true,
      "autoWidth": false,
      "responsive": true,
      "language": {
        "url": "//cdn.datatables.net/plug-ins/1.11.5/i18n/zh.json"
      }
    });
  });
</script>
</body>
</html> 